package com.example.laboratory.root_ui.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.example.laboratory.R;
import com.example.laboratory.bean.Record;
import com.example.laboratory.bean.UserList;
import com.example.laboratory.common.ListDataHolder;
import com.example.laboratory.inter.OnUserInfoItemClickListener;
import com.example.laboratory.ui.adapter.BaseListAdapter;

public class UserInfoListAdapter extends BaseListAdapter<UserList.UserListBean> {

    @BindView(R.id.tv_job_number)
    TextView tvJobNumber;
    @BindView(R.id.tv_user_name)
    TextView tvUserName;

    private OnUserInfoItemClickListener listener;

    public UserInfoListAdapter(OnUserInfoItemClickListener listener) {
        this.listener = listener;
    }

    @Override
    protected int getLayoutId(int viewType) {
        return R.layout.item_user_info_list;
    }


    @Override
    public void bindDatas(ListDataHolder holder, UserList.UserListBean bean, int itemType, int position) {
        ButterKnife.bind(this,holder.itemView);
         tvJobNumber.setText(bean.getJobNumber());
        tvUserName.setText(bean.getUsername());

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onItemClick(position, bean);
                }
            }
        });

    }
}
